package kku.cs.fgl.transition;

import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.StateBasedGame;

public class Zoom extends Move {
    private  float scale1=1,scale2=1;
    
	public Zoom() {
	}

	public Zoom(float tx, float ty, int mode) {
		super(tx, ty, mode);
	}

	public Zoom(int duration, float tx, float ty, int mode) {
		super(duration, tx, ty, mode);
	}

	void init(StateBasedGame game, GameContainer container, Graphics g) {
		if(mode==MOVE_IN){
			scale1 = 0.01f;
			scale2 = 1f;
		}else if(mode==MOVE_OUT){
			scale1 = 1f;
			scale2 = 0.01f;
		}
		super.init(game, container);
	}

	public void updateScene(float dtime){
		float s = scale1+(scale2-scale1)*dtime;
		scene1.setScalex(s);
		scene1.setScaley(s);
		//System.out.println("scale "+s+" scale1="+scale1+" dtime="+dtime);
		super.updateScene(dtime);
	}
	
}
